package Lee_code;

import java.util.HashMap;

public class Lee_205 {

    public boolean isIsomorphic(String s, String t) {
        if(s.length()!=t.length())
            return  false;

        HashMap<Character, Character> map = new HashMap<>();
        char[] s1 = s.toCharArray();
        char[] t1 = t.toCharArray();
        for(int i=0; i<s.length(); i++)
        {

            if(map.get(s1[i])==null)
            {
                if(map.containsValue(s1[i]))
                    return false;
                else
                {
                    map.put(s1[i], t1[i]);
                }

            }

            else
            {
                if(map.get(s1[i])!=t1[i])
                    return false;
            }
        }
        return  true;
    }
    public static void main(String[] args) {

    }
}
